home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-01 | 2.8 KB | 112 lines | [TEXT/CWIE] |
-
-
- // ----- ix/iy + CB Command Dispatcher -----------------------------------------------
- // entry condition: a1 points to the required index register
-
- // Handling of illegals: (G.Lunter: Z80.DOC)
- // index n is read immediately after CB for every IXCB/IYCB instruction, even if not used
- // { DD CB nn XX } works like { DD CB nn (XX&F8+6) } and copies result to register (XX&07)
-
-
- XYCB:
-
- // ----- don't increment r register
- // double shifted opcodes increment r by 2
- // and this is done in the main instruction dispatcher (( +1 ))
- // and in the ix/iy command dispatcher (( +1 again ))
- #if EXACT_R
- #endif
-
-
- // ----- update T cycle counter
- // all shift, bit set and bit clear instructions take 23 T cycles
- // all bit test instructions take 20 T cycles
- more8
- more4 // 4+8+4 = 16 T cycles
-
-
- // ----- calculate target address ------------------------------------------------
- move.b (ip)+,core // offset n
- ext.w core
- add.w ir,core // target address ir+n
-
-
- // ----- get instruction --------------------------------------------------------
- move.b (ip)+,db // instruction
-
-
- // ----- debugger related testings ----------------------------------------------
- #if CMD_PROFILE || cmd_firstuse
- movea.l cnt_xycb,a0
- // addq.l #1,(a0,db.l*4)
- lsl #2,db
- addq.l #1,(a0,db.l)
- lsr #2,db
- #if cmd_firstuse
- bne.s cmdicb2 }; Do_1st_Instr ( ip-4 ); asm { cmdicb2:
- #endif
- #endif
-
-
- // ----- load target address in a0 register ------------------------------
- move.l core,a0 // a0 -> target of operation
-
-
- // ----- check for illegal instruction ------------------------------------
- #if exact_xy_bit
- subq.b #6,db // assume: (hl)
- moveq #0x07,d0
- and.b db,d0
- bne.s cbxill // illegal register => special action
- #endif
-
-
- // ----- dispatch ------------------------------------------------------
- cbxdis: lsr.b #3,db
- dc.w 0x43FB, 0x4A06 // lea *+$08(D4.l*2),A1
- adda.w (a1),a1
- jmp (a1)
-
- // if exact_xy_bit, all these entries must preserve A0
- // note: handling after write_to_rom should be corrected
- cbxtab: dc.w rlcx, rrcx, rlx, rrx, slax, srax, sllx, srlx
- dc.w bit0x, bit1x, bit2x, bit3x, bit4x, bit5x, bit6x, bit7x
- dc.w res0x, res1x, res2x, res3x, res4x, res5x, res6x, res7x
- dc.w set0x, set1x, set2x, set3x, set4x, set5x, set6x, set7x
-
-
- #if exact_xy_bit
- // illegal register number
- cbxill: addq.b #6,db
- move.l loop,-(a7)
- lea cbxx,loop
- bra.s cbxdis // back to normal dispatcher
-
- // after normal instruction execution, copy result (core.l) to register
- cbxx: move.l (a7)+,loop
- move.b (a0),db // get result
- do_info_illegals4
- moveq #0x07,d0
- and.b -1(ip),d0 // get register
- add.l d0,d0
- lea cbx_tab(d0.l),a1
- adda.w (a1),a1
- jmp (a1)
-
- cbx_tab: dc.w cbxb, cbxc, cbxd, cbxe, cbxh, cbxl, nxtcmnd, cbxa
- cbxb: move.b db,RB; m_next
- cbxc: move.b db,RC; m_next
- cbxd: move.b db,RD; m_next
- cbxe: move.b db,RE; m_next
- cbxh: move.b db,RH; m_next
- cbxl: move.b db,RL; m_next
- cbxa: move.b db,a; m_next
- #endif
-
-
-
-
-
-
-
-